﻿@model NCP.Model.DeptMergeInfo
@{
    ViewBag.Title = "合并科室对照";
}
<div class="layui-card" style="height:550px !important;">
    <div class="layui-card-header">
        <span style="margin-left:10px;margin-right:100px;font-size:large;font-weight:600;">@Model.DeptName [@Model.DeptCode]</span>   
        <button class="layui-btn" type="button" onclick="doAdd()">
            保存
        </button>
        <button class="layui-btn layui-btn-danger" type="button" onclick="onCancel()">
            取消
        </button>
    </div>
    <div class="layui-card-body">
        <div id="test-transfer-dept"></div>
    </div>
</div>
<script>
    var transfer;
    var admin;
    layui.config({
        base: '/layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index', 'transfer', 'layer', 'util'], function () {
        var $ = layui.$
            , layer = layui.layer
            , util = layui.util;
        admin = layui.admin;
        transfer = layui.transfer

        //显示搜索框
        transfer.render({
            elem: '#test-transfer-dept'
            , data: eval(@Html.Raw(ViewData["data"]))
            , title: ['His科室', '选中科室']
            , id: 'test-transfer-dept'
            , showSearch: true
            , width: 300
            , height: 450
            , value: eval(@Html.Raw(ViewData["checkeddata"]))
        });

    });

    function doAdd() {
        var datas = transfer.getData('test-transfer-dept');
        var depts = "";
        for (var i = 0; i < datas.length; i++) {
            depts += datas[i].value + "|";
        }
        var params = "mergeCode=@Request["deptCode"]&depts=" + depts;
        admin.req({
            url: '/DeptMergeInfo/Compare' //实际使用请改成服务端真实接口
            , method: 'post'
            , data: params
            , done: function (res) {
                layer.alert(res.msg);
            }
        });
    }
    function onCancel() {
        var index = parent.layer.getFrameIndex(window.name);
        parent.layer.close(index);
    }
</script>
